package com.test.down;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

/**
 * author:吴昶
 * date: {2019年11月18日09:11:07}
 * 简介: 拦截所有的手势滑动
 **/
public class NoParentTouchEventLinearLayout extends LinearLayout {
    public NoParentTouchEventLinearLayout(Context context) {
        super(context);
    }

    public NoParentTouchEventLinearLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public NoParentTouchEventLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        getParent().requestDisallowInterceptTouchEvent(true);
        return super.dispatchTouchEvent(ev);
    }
}

